<!--
  @author LiSong
  @date 2023-6-30
  @description 地市审核
-->
<template>
  <div class="home-panel">
    <div class="home-item-wrapper">
      <div class="home-item-panel">
        <HomeCard headName="项目审核" headIcon="no-audit">
          <HomeTodoCard
            card-mode="review"
            :cardItems="projAuditItems"
          />
        </HomeCard>
      </div>
    </div>
    <div class="home-item-wrapper">
      <div class="home-item-panel">
        <HomeCard headName="项目下级审核" headIcon="no-audit">
          <HomeTodoCard
            card-mode="review"
            :cardItems="projBelowAuditItems"
          />
        </HomeCard>
      </div>
    </div>
    <div class="home-item-wrapper">
      <div class="home-item-panel">
        <HomeWorkload />
      </div>
    </div>
  </div>
</template>

<script setup>
import HomeCard from '../items/HomeCard.vue'
import HomeUtils from '../config/home-utils'
import HomeWorkload from '../items/HomeWorkload.vue'
import HomeTodoCard from '../items/HomeTodoCard.vue'

const props = defineProps({
  loading: { type: Boolean, default: false },
  todoData: { type: [ Object, Array ] }
})
// 项目审核数据
const projAuditItems = ref([])
// 项目下级审核数据
const projBelowAuditItems = ref([])

watch(
  () => props.todoData,
  (newValue, oldValue) => {
    const { auditItems, belowAuditItems } = HomeUtils.tranfAuditData(newValue)
    projAuditItems.value = auditItems
    projBelowAuditItems.value = belowAuditItems
  },
  {deep: false, immediate: false}
)

</script>

<style lang="scss" scoped>
</style>
